package top.caoayu.controller;

import com.sun.org.apache.xpath.internal.operations.Mod;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import top.caoayu.service.impl.UserServiceImpl;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.time.LocalDateTime;

/**
 * @Author: caoxinyu
 * @Date: 2023/8/25-16:35
 */
@Controller
public class UserController {
    @Resource
    UserServiceImpl userService;
    @RequestMapping("/user")
    public ModelAndView list(HttpServletRequest req, HttpServletResponse res){
        ModelAndView view = new ModelAndView();
        view.addObject("user", userService.findAll());
        view.addObject("time", LocalDateTime.now());
        view.setViewName("user");
        return view;
    }
}
